﻿using log4net;
using Microsoft.VisualBasic;

namespace JT809.GpsRedisConsumer
{
    public class MyQuartHostedService : IHostedService
    {
        private readonly QuartzStartup _quartz;
        private readonly ILog _logger;

        public MyQuartHostedService(QuartzStartup quartzStartup)
        {
            _quartz = quartzStartup;
            _logger = LogManager.GetLogger(LogHelper.Repository.Name, GetType().Name);
        }

        public Task StartAsync(CancellationToken cancellationToken)
        {
            _logger.Info("========== QuartzApplication Start ==========");
            _ = _quartz.Start();
            return Task.CompletedTask;
        }

        public Task StopAsync(CancellationToken cancellationToken)
        {
            //_quartz.Stop();
            _logger.Info("========== QuartzApplication Stop ==========");
            return Task.CompletedTask;
        }
    }
}
